#pragma once

#ifndef MESHEDITOR_H
#define MESHEDITOR_H

#include <QtGui/QMainWindow>
#include "ui_mesheditor.h"
#include <Ogre.h>
#include <LitEditorInstance.h>
#include <LitString.h>
#include <LitCore.h>
#include <LitExceptions.h>
#include <LitEditorSettingsDialog.h>
#include <LitInitialiser.h>
#include <LitEditorProject.h>
#include <LitSceneManager.h>
#include "MeshProject.h"
#include "Input.h"

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
	#pragma comment(lib, "user32.lib")
#endif

namespace Lit
{
	namespace Editor
	{
		class MeshEditor : public QMainWindow, public RenderWidgetListener
		{
			Q_OBJECT

			Instance *		mInstance;
			MeshProject*	mProject;
			Lit::LightPtr	mLight;
			Lit::Physics::WorldPtr mWorld;
		public:
			MeshEditor(QWidget *parent = 0, Qt::WFlags flags = 0);
			~MeshEditor();
			
			void setupUi();
			void updateUi( );
			
			void closeEvent( QCloseEvent * evt );

			virtual void createScene();
			virtual void destroyScene();
		protected:

			Ui::MeshEditorClass ui;
			void meshPreviewCallback(const std::string &name, size_t current, size_t num_mesh );
			
			void mouseScrolled( int d );
			void mouseMoved( const QPoint& pos, Qt::MouseButtons );
			bool frameStarted( const Ogre::FrameEvent &evt );

		protected slots:
			void on_actionNew_Project_triggered();
			void on_actionOpen_Project_triggered();
			void on_actionSave_Project_triggered();
			void on_actionClose_Project_triggered();
			void on_actionImport_Mesh_triggered();
			void on_actionExport_Mesh_triggered();
			void on_actionExit_triggered(){ qApp->quit(); }
			
			void on_actionPause_Simulation_triggered( bool state );
			void on_actionDebugger_triggered( bool state );
			
			void on_actionCreate_Mesh_Pack_triggered();
			void on_actionPhysics_Options_triggered();
			void on_actionOptions_triggered();
		};
	};
};

#endif // MESHEDITOR_H
